package com.sl.biz.modular.process.controller;

import com.sl.biz.modular.process.controller.request.*;
import com.sl.biz.modular.process.service.ProcessVersionContentBizService;
import com.sl.common.pojo.CommonResult;
import lombok.RequiredArgsConstructor;
import org.checkerframework.checker.units.qual.C;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/process/test")
@RequiredArgsConstructor
public class ProcessTestController {
    private final ProcessVersionContentBizService versionContentBizService;

    @PostMapping("/get_tid")
    public CommonResult<String> getTid() {
        return CommonResult.data(versionContentBizService.tid());
    }


    @PostMapping("/run")
    public Object run(@RequestBody @Validated SquareLakeProcessRunRequest runRequest) {
        return versionContentBizService.run(runRequest);
    }

    @PostMapping("/compensate")
    public Object compensate(@RequestBody @Validated SquareLakeProcessComensateRequest runRequest) {
        return versionContentBizService.compensate(runRequest);
    }


    @PostMapping("/step/run")
    public Object stepRun(@RequestBody @Validated SquareLakeProcessStepRunRequest runRequest) {
        return versionContentBizService.stepRun(runRequest);
    }

    @PostMapping("/step/runWithResultToFieldDefine")
    public Map<String, Object> runWithResultToFieldDefine(@RequestBody @Validated SquareLakeProcessResultToFieldDefineRequest runRequest) {
        return versionContentBizService.runWithResultToFieldDefine(runRequest);
    }


    @PostMapping("/step_pause")
    public Boolean stepPause(@RequestBody @Validated SquareLakeProcessStepPauseRequest runRequest) {
        return versionContentBizService.stepPause(runRequest);
    }

    @PostMapping("/step_resume")
    public Boolean stepResume(@RequestBody @Validated SquareLakeProcessStepPauseRequest runRequest) {
        return versionContentBizService.stepResume(runRequest);
    }

    @PostMapping("/trans_resume")
    public Boolean transResume(@RequestBody @Validated SquareLakeProcessStepPauseRequest runRequest) {
        return versionContentBizService.transResume(runRequest);
    }

    @PostMapping("/trans_resume_all")
    public Boolean transResumeAll(@RequestBody @Validated SquareLakeProcessStepPauseRequest runRequest) {
        return versionContentBizService.transResumeAll(runRequest);
    }
}

